<?php

namespace App\Models\Entity\Column;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class ColumnTypeIcon
 * @package App\Models\Entity\Column
 * @version August 9, 2018, 11:16 am CST
 *
 * @property \App\Models\Entity\Column\ColumnType columnType
 * @property string name
 * @property string title
 * @property integer column_type_id
 * @property integer is_default
 * @property string type
 * @property string image
 * @property string icon
 */
class ColumnTypeIcon extends Model
{
    use SoftDeletes;


    public $table = 'column_type_icons';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'name',
        'title',
        'column_type_id',
        'is_default',
        'type',
        'image',
        'icon'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'name' => 'string',
        'title' => 'string',
        'column_type_id' => 'integer',
        'is_default' => 'integer',
        'type' => 'string',
        'image' => 'string',
        'icon' => 'string'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        'name' => 'required|max:100'
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function columnType()
    {
        return $this->hasOne(\ App\Models\Entity\Column\ColumnType::class, 'id', 'column_type_id');
    }
}
